//
//  EditorView.h
//  LabanBrowser
//
//  Created by Xh2 on 3/24/13.
//  Copyright (c) 2013 VNG. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "BookmarkModel.h"
#import "SpeedDialModel.h"
#import "HistoryModel.h"

@protocol EditorDelegate <NSObject>

-(void)onEditorCancel;
-(void)onEditorAddingBookmarkSuccessfully:(BookmarkModel*)_bookmark;
-(void)onEditorUpdatingBookmarkSuccessfully:(BookmarkModel*)_bookmark;
-(void)onEditorUpdatingSpeedDialSuccessfully:(SpeedDialModel*)_speedDial;
@end




@interface EditorView : UIView <UITextFieldDelegate>
typedef enum{
    UpdateSpeedDial=0,
    UpdateBookmark=1,
    AddBookmark=2
}EditorType;
     
@property (weak, nonatomic) IBOutlet UITextField *titleTF;
@property (weak, nonatomic) IBOutlet UITextField *urlTF;
@property (weak, nonatomic) IBOutlet UIButton *okBT;
- (IBAction)okAction:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *cancelBT;
- (IBAction)cancelAction:(id)sender;
@property (nonatomic) id<EditorDelegate> delegate;
@property (weak, nonatomic) IBOutlet UIView *contentView;
@property (weak, nonatomic) IBOutlet UIImageView *shadowView;
@property (weak, nonatomic) IBOutlet UILabel *contentTitleLB;

@property (nonatomic) BaseModel* currentEditingModel;
@property (nonatomic) EditorType currentEditorType;


-(void)initialize;

-(void)show;
-(void)hide;
-(void)relocalize;
-(void)autoAdjustToFrame:(CGRect)frame;

-(void)receiveModel:(HistoryModel *)_model WithType:(EditorType)_type;

@end
